package com.example.linktop.broadcastbestpractice;

import android.app.Activity;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by linktoplinktop on 2017/7/4.
 * 工厂类
 */
public class ActivityController {

    private static List<Activity> list = new ArrayList<>();
    /* 添加活动 */
    public static void addActivity(Activity activity) {
        list.add(activity);

    }

    /* 移除活动 */
    public static void removeActivity(Activity e) {

        list.remove(e);

    }

    /* 关闭所有活动 */

    public static void finishAll() {
        for (Activity e:list) {
            if (!e.isFinishing()) {
                e.finish();

            }


        }


    }
}
